package com.filetransfer.viewmodel;
import com.filetransfer.view.Components.render.LocalPathEditor;
import com.filetransfer.view.Components.render.LocalPathRender;
import com.filetransfer.view.Components.render.ProgressBarRenderer;
import com.filetransfer.viewmodel.base.TaskTableModel;
import lombok.extern.slf4j.Slf4j;

import javax.swing.table.TableColumnModel;
@Slf4j
public class DownloadTableViewModel extends TaskTableModel {
    public static final String[] columnNames = {"下载任务名称", "状态", "进度", "下载链接", "本地路径"};
    public DownloadTableViewModel() {
        super(columnNames);
    }
    @Override
    public void editColumnModel(TableColumnModel model) {
        super.editColumnModel(model);
        model.getColumn(2).setCellRenderer(new ProgressBarRenderer());
        model.getColumn(4).setCellRenderer(new LocalPathRender());
        model.getColumn(4).setCellEditor(new LocalPathEditor());
    }
    @Override
    public boolean isCellEditable(int row, int column) {
        return column == 4;
    }
}
